/***************************************************************************
 * Kinect Handler
 * -receives method calls from Kinect Listener
 * -in charge of filtering the raw gestures and forwarding meaningful signals to GUI
 * -extends StateHandler
 *                                                                         
 ***************************************************************************/

#ifndef KINECTHANDLER_H
#define KINECTHANDLER_H

#include "devices/StateHandler.h"
#include <QLineF>
#include <qtransform.h>

class DeviceManager;

//constants used when converting the relative screen position [0,1] into 
//screen coordinates. Decrease to make interactive area smaller
#define COORD_SCALE_X 600
#define COORD_SCALE_Y 500
#define COORD_SCALE_Z 600

//enumerator for the different swipe directions
enum SwipeType { SWIPE_RIGHT,
				 SWIPE_LEFT, 
				 SWIPE_UP, 
				 SWIPE_DOWN };

//enumerator for the screen regions; used when detecting swipe gestures
enum ScreenRegion { MIDDLE_REGION,
					LEFT_REGION,
					RIGHT_REGION };

//class def
class KinectHandler : public StateHandler {
	Q_OBJECT

public:
	KinectHandler(DeviceManager *dm);
	~KinectHandler() {}

public slots:
    void slotUpdateInputPoint(int id, InputState state);
	void receivePointUpdate(double x, double y, double z, int id);
	void receivePush(int pointNumber);
	void receivePointCreate(int id);
	void receivePointDestroy(int id);
	void receiveKinectConnected();

private:
	bool m_hasPrimary;
	bool m_hasSecondary;
	int m_primaryID, m_secondaryID;
	bool m_primaryRed, m_secondaryRed;
	ScreenRegion m_primaryRegion, m_secondaryRegion;

	DeviceManager *m_deviceManager;

	//For saved states
	InputPoint m_savedPrimary;
	InputPoint m_savedSecondary;
	bool m_isTransforming;
};
#endif //KINECTHANDLER_H